/**
 * 
 */
package uk.ac.manchester.cs.graph.alg;

import java.util.HashSet;
import java.util.Set;

/**
 * A tiny visitor useful for getting all vertices reachable from a certain vertex
 * in a graph
 * 
 * @author Pavel Klinov
 *
 * pklinov@cs.man.ac.uk, pklinov@clarkparsia.com
 * 
 * Mar 6, 2011
 */
public class ClosureVisitor<V> implements VertexVisitor<V> {

	private Set<V> m_closure = new HashSet<V>();
	
	/* 
	 */
	@Override
	public boolean visit(V vertex) {

		m_closure.add( vertex );
		
		return true;
	}
	
	public Set<V> getVertices() {
		
		return m_closure;
	}
}
